﻿/**
 * CreditsScreen.cs - Credits screen  (info about authors)
 * 
 * Part of BoulderDAM - A BoulderDash clone using C# and SDL
 * Nacho Cabanes & students of DAM IES San Vicente, 2014
 * 
 * Revisions
 * #     Date         Creator, changes
 * ----  -----------  -------------------------------------------------------
 * 0.01  02-apr-2014  Nacho Cabanes: Basic credits screen, showing static text
 * 0.02  03-apr-2014  Saúl Sánchez & Pau Chorro: Added background image. 
 *                    Repositioned text.
 *                    
 * 0.03 07-apr-2014   Boro y Pau : Draw programers name on screen whit animation (uping animation)
 */
using System;
using System.IO;
using System.Collections.Generic;


namespace Boulder
{
    class CreditsScreen
    {
        private Font font18;
        Image background;
        short y;
        List<string> myList = new List<string>();
        
        string pressEsc = "Hit ESC to return";
        string creditVar = "By DAM Ies San Vicente 2013-2014";
        Sound mySoundBase;


        // read textFile programers and store in array
            

        public CreditsScreen()
        {
            font18 = new Font("data/Joystix.ttf", 18);
            background = new Image("data/boulder_present01.png");
        }

        public void Run()
        {
            StreamReader file;
            string aux;
            file = File.OpenText("programers.txt");
            do
            {
                aux = file.ReadLine();
                if (aux != null)
                {
                    myList.Add(aux);
                }
            } while (aux != null);
            file.Close();
            do
            {
                
                foreach (string name in myList)
                {
                    Hardware.ClearScreen();
                    Hardware.DrawHiddenImage(background, 0, 0);
                    Hardware.WriteHiddenText(creditVar,
                        50, 50,
                        0xCC, 0xCC, 0xCC,
                        font18);
                    Hardware.WriteHiddenText(pressEsc,
                        700, 50,
                        0x99, 0x99, 0x99,
                        font18);

                    y = 100;
                    y = 550;
                    byte redColourEsc = 255;
                    byte greenColourEsc = 0;

                    while ((y > 100) && (!Hardware.KeyPressed(Hardware.KEY_ESC)))
                    {
                        Hardware.DrawHiddenImage(background, 0, 0);

                        //Draw moving up programmers
                        Hardware.WriteHiddenText(name,
                            Convert.ToInt16(512 - name.Length * 14 / 2), y, //Center text(x,y)          
                            255, 255, 255,
                            font18);

                       
                        Hardware.ShowHiddenScreen();
                        Hardware.Pause(10);
                        greenColourEsc += 5;
                        redColourEsc -= 5;
                        y--; ;
                    }          
                }

                
               
                Hardware.ShowHiddenScreen();
                Hardware.Pause(20);
            }
            while (!Hardware.KeyPressed(Hardware.KEY_ESC));
        }
    }
}

/* PROGRAMMERS
 * 
 * David Caamaño Aldemunde
 * Boro Caballero Alfonso
 * Adil Casamayor Silvar
 * Pau Chorro Yanguas
 * Maria Alejandra De Freitas García
 * Jose Antonio Estrada Lillo
 * Reinaldo David Ferreira López
 * Juan Carlos Gallardo Espuch
 * María Luz García Rodríguez
 * Álvaro Gironés García
 * Alejandro López Reyes
 * Ramón Ismael March Fuentes
 * Omar Marín Pastor
 * Alejandro Marín Pons
 * Tomás Martínez Sempere
 * Luis Massó Saiz
 * Manuel Jesús Navarro Rufete
 * Luis Miguel Rubio Toledo
 * Jesús Gabriel Sagra Alcalá
 * Reinel Salazar Orozco
 * Cristóbal Sánchez Serrano
 * Saúl Sánchez Violero
 * Daniel Segura Pérez
 * Javier Soler Cano
 * Pau Tirado Hernández
 * Marco Uceda Lopez
 * José Luis Valdevira Toledo
 * Jose Francisco Valdes Sirvent
 */